import { listAllTableData, exportSelfTestTable, addData, queryPersonInfoByNameOrIdCard, updateRecord, findById, findAllDictName, insertOfficeInfo, newQueryAllExportData, getVillagesByNameOrIdCard, deleteById, pushNation } from '@/services/crowdDataReportApi';

export default {
    namespace: 'crowdDataReport',

    state: {

    },

    effects: {

        /**
          * 分页
          * @param payload
          * @param call
          * @param put
          * @returns {Generator<*, *, *>}
          */
        *listAllTableData({ payload }, { call, put }) {
            const response = yield call(listAllTableData, payload);
            return response;
        },


        *exportSelfTestTable({ payload }, { call, put }) {
            const response = yield call(exportSelfTestTable, payload);
            return response;
        },


        /**
        * 添加
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *addData({ payload }, { call, put }) {
            const response = yield call(addData, payload);
            return response;
        },

        /**
        * 查询
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *queryPersonInfoByNameOrIdCard({ payload }, { call, put }) {
            const response = yield call(queryPersonInfoByNameOrIdCard, payload);
            return response;
        },

        /**
        * 详情
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *findById({ payload }, { call, put }) {
            const response = yield call(findById, payload);
            return response;
        },

        /**
        * 修改
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *updateRecord({ payload }, { call, put }) {
            const response = yield call(updateRecord, payload);
            return response;
        },

        /**
        * 字典
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *findAllDictName({ payload }, { call, put }) {
            const response = yield call(findAllDictName, payload);
            return response;
        },


        /**
        * 正式库
        * @param payload
        * @param call
        * @param put
        * @returns {Generator<*, *, *>}
        */
        *insertOfficeInfo({ payload }, { call, put }) {
            const response = yield call(insertOfficeInfo, payload);
            return response;
        },

        *deleteById({ payload }, { call, put }) {

            const response = yield call(deleteById, payload);
            return response;
        },

        /**
   * 点击导出列表信息
   * @param payload
   * @param call
   * @param put
   * @returns {Generator<*, *, *>}
   */
        *newQueryAllExportData({ payload }, { call, put }) {
            const response = yield call(newQueryAllExportData, payload);
            return response;
        },


        /**
  * 查询
  * @param payload
  * @param call
  * @param put
  * @returns {Generator<*, *, *>}
  */
        *getVillagesByNameOrIdCard({ payload }, { call, put }) {
            const response = yield call(getVillagesByNameOrIdCard, payload);
            return response;
        },
        /**
         * 数据推送至国家平台
        * @param payload
        * @param call
         * @param put
        * @returns {Generator<*, *, *>}
         */

        *pushNation({ payload }, { call, put }) {
            const response = yield call(pushNation, payload);
            return response;
        },

    },

    reducers: {

    },
};
